-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multidimensional Views 🦏 #288
Conversation
…feat-192-nviews Conflicts: dash/include/dash/View.h dash/include/dash/view/IndexSet.h dash/include/dash/view/Sub.h dash/test/TestBase.h
@fmoessbauer @devreal @rkowalewski Bounce for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many good changes in here! Just some comments inline.
build.dev.sh
Outdated
-DENABLE_DEV_COMPILER_WARNINGS=ON \ | ||
-DENABLE_EXT_COMPILER_WARNINGS=ON \ | ||
-DENABLE_DEV_COMPILER_WARNINGS=OFF \ | ||
-DENABLE_EXT_COMPILER_WARNINGS=OFF \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave warnings on by default on dev
builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that was by accident.
dash/include/dash/Cartesian.h
Outdated
/// Number of dimensions of the cartesian space, initialized with 0's. | ||
SizeType _ndim = NumDimensions; | ||
SizeType _rank = NumDimensions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment and real initialization diverge here. I guess initialization with 0
would be correct?
dash/include/dash/GlobRef.h
Outdated
: _gptr(DART_GPTR_NULL) { | ||
} | ||
: _gptr(DART_GPTR_NULL) | ||
{ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you no delete
t'is? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what the TODO comment refers to. There are situations where GloRef objects are temporarily uninitialized. Perhaps I can eliminate them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I already did! delete
d the default constructor.
class Ref_ > | ||
constexpr GlobViewIter( | ||
// const GlobViewIter<nonconst_value_type, P_, GM_, Ptr_, Ref_> & other) | ||
const GlobViewIter<T_, P_, GM_, Ptr_, Ref_> && other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be const GlobViewIter<T_, P_, GM_, Ptr_, Ref_> & other
for the copy c'tor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
@@ -335,7 +335,7 @@ void perform_test( | |||
|
|||
if (myid == 0) { | |||
if (iteration == 0) { | |||
cout << "-- Pattern: " << pattern << endl | |||
cout << "-- Pattern: " << dash::internal::typestr(pattern) << endl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, but it would be very useful to have some documentation on the dash::internal
s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, will add Doxygen comments for the new features. Note that namespace internal
is excluded from API docs for obvious reasons. Perhaps some helpers like typestr
should be public instead.
typeid(T).name() | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation! Otherwise we will re-invent this in a couple of month, as no one knows that this exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above. I moved dash::internal::typestr
to dash::typestr
in header dash/meta/TypeInfo.h
, it's documented and part of the public API now.
class Ref_ > | ||
constexpr GlobViewIter( | ||
// const GlobViewIter<nonconst_value_type, P_, GM_, Ptr_, Ref_> & other) | ||
const GlobViewIter<T_, P_, GM_, Ptr_, Ref_> && other) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
_globmem, | ||
*_pattern, | ||
g_idx | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine it to an oneliner to enable RVO.
@@ -799,7 +818,6 @@ class BlockPattern<1, Arrangement, IndexType> | |||
/// Global block index | |||
index_type g_block_index) const | |||
{ | |||
#if 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all these #if #else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deactivated code sections are previous implementations before I rewrote them as constexpr. Left them as comments to help debugging in case my constexpr variant was broken. Will remove them.
@@ -1354,15 +1336,15 @@ class TilePattern | |||
/** | |||
* Cartesian arrangement of pattern blocks. | |||
*/ | |||
const BlockSpec_t & blockspec() const | |||
constexpr const BlockSpec_t & blockspec() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this can be made noexcept? Same for most of the other methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, but that's not the actual concern of this PR.
std::vector<iterator> _groups; | ||
std::vector<std::string> _group_domain_tags; | ||
/// Split domains in the team locality, one domain for every split group. | ||
std::vector<self_t> _parts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these changes in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serendipity.
0, // accumulate init | ||
std::multiplies<index_type>() // reduce op | ||
); | ||
*/ | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be so beautiful in C++14 ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in CLisp <3
@@ -0,0 +1,11 @@ | |||
config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Do we already have some regression testing provider?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on it, currently works for a prototype on my machine.
virtual ~AccumulateTest() { | ||
LOG_MESSAGE("<<< Closing test suite: AccumulateTest"); | ||
} | ||
_dash_size(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IL not necessary as this is derived from TestBase
@devreal @fmoessbauer Your requested changes are addressed in my last commits. 🦏 |
This is a really really cool feature!!! |
I'm quite satisfied for now, too. https://github.com/dash-project/dash/blob/feat-192-nviews/dash/test/view/ViewTest.cc#L786
It's horrible to express manually, even in pseudo code. |
Addresses #192
For use cases of multi-dimensional views, see tests:
https://github.com/dash-project/dash/blob/feat-192-nviews/dash/test/view/NViewTest.cc
https://github.com/dash-project/dash/blob/feat-192-nviews/dash/test/view/ViewTest.cc
Current benchmark results:
gcc 5.4
This PR also includes some meta-helpers for ranges and container types:
https://github.com/dash-project/dash/blob/feat-192-nviews/dash/include/dash/Meta.h
To test if a type can be used for container elements, use:
This is now used in all available container types.